package wili.b1.impl;

//import com.sap.db.jdbc.HanaClob;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class ResultSetObj implements ResultSet {
	final ResultSetMetaDataObj meta;

	final List<Object[]> dataList;

	final Map<String, Object> valueMap;

	ResultSet rs;

	private AtomicInteger lineNo;

	boolean gotFromCache = false;//isClosed.

	boolean isClosed = false;

	public void useCachedObject() {
		isClosed = false;
		lineNo = new AtomicInteger(0);
		gotFromCache = true;
	}

	public ResultSetObj newInst() {
		return new ResultSetObj(this);
	}

	private ResultSetObj(ResultSetObj rs) {
		this.meta = rs.meta;
		this.dataList = rs.dataList;
		this.valueMap = rs.valueMap;
		this.gotFromCache = true;
		this.isClosed = true;
	}

	<T> T valueOf(Object key) {
		return (T) valueMap.get(key);
	}

	@Override
	public boolean next() throws SQLException {
		if (gotFromCache) {
			if (lineNo.incrementAndGet() <= dataList.size())
				return true;
			return false;
		} else if (!rs.isClosed()) {
			if (rs.next()) {
				Object[] cc = new Object[meta.getColumnCount()];
				dataList.add(cc);
				for (int i = 0; i < cc.length; i++) {
					cc[i] = this.getObject(i + 1);
				}
				return true;
			}
			return false;
		} else {
			return false;
		}
	}

	@Override
	public ResultSetMetaData getMetaData() throws SQLException {
		return this.meta;
	}

	public ResultSetObj(ResultSet rs, List<Object[]> dataList) {
		if (rs instanceof ResultSetObj)
			throw new RuntimeException(rs.getClass().getName());
		try {
			this.rs = rs;
			this.dataList = dataList == null ? new ArrayList<>() : dataList;
			this.valueMap = new HashMap<>();
			this.meta = new ResultSetMetaDataObj(rs.getMetaData());
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public void close() throws SQLException {
		if (gotFromCache) {
			isClosed = true;
		} else {
			rs.close();
		}
	}

	@Override
	public boolean wasNull() throws SQLException {
		Object ret;
		if (gotFromCache) {
			ret = valueOf("wasNull");
		} else {
			valueMap.put("wasNull", ret = rs.wasNull());
		}
		return (Boolean) ret;
	}

	@Override
	public String getString(int columnIndex) throws SQLException {
		Object ret = this.getObject(columnIndex);
		if (ret == null)
			return (String) null;
		if (ret instanceof String)
			return (String) ret;
		return ret.toString();
	}

	@Override
	public boolean getBoolean(int columnIndex) throws SQLException {
		return (boolean) getObject(columnIndex);
	}

	@Override
	public byte getByte(int columnIndex) throws SQLException {
		return (byte) getByte(columnIndex);
	}

	@Override
	public short getShort(int columnIndex) throws SQLException {
		return (byte) getObject(columnIndex);
	}

	@Override
	public int getInt(int columnIndex) throws SQLException {
		//return rs.getInt(columnIndex);
		return (Integer) this.getObject(columnIndex);
	}

	@Override
	public long getLong(int columnIndex) throws SQLException {
		return (Long) this.getObject(columnIndex);
	}

	@Override
	public float getFloat(int columnIndex) throws SQLException {
		return (Float) this.getObject(columnIndex);
	}

	@Override
	public double getDouble(int columnIndex) throws SQLException {
		return (Double) this.getObject(columnIndex);
	}

	@Override
	public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
		return (BigDecimal) this.getObject(columnIndex);
	}

	@Override
	public byte[] getBytes(int columnIndex) throws SQLException {
		return (byte[]) this.getObject(columnIndex);
	}

	@Override
	public Date getDate(int columnIndex) throws SQLException {
		return (Date) this.getObject(columnIndex);
	}

	@Override
	public Time getTime(int columnIndex) throws SQLException {
		return (Time) this.getObject(columnIndex);
	}

	@Override
	public Timestamp getTimestamp(int columnIndex) throws SQLException {
		return (Timestamp) this.getObject(columnIndex);
	}

	@Override
	public InputStream getAsciiStream(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData1");
		return null;
	}

	@Override
	public InputStream getUnicodeStream(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData2");
		return null;
	}

	@Override
	public InputStream getBinaryStream(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData3");
		return null;
	}

	@Override
	public String getString(String columnLabel) throws SQLException {
		return (String) this.getObject(columnLabel);
	}

	@Override
	public boolean getBoolean(String columnLabel) throws SQLException {
		return (Boolean) this.getObject(columnLabel);
	}

	@Override
	public byte getByte(String columnLabel) throws SQLException {
		return (Byte) this.getObject(columnLabel);
	}

	@Override
	public short getShort(String columnLabel) throws SQLException {
		return (Short) this.getObject(columnLabel);
	}

	@Override
	public int getInt(String columnLabel) throws SQLException {
		return (Integer) this.getObject(columnLabel);
	}

	@Override
	public long getLong(String columnLabel) throws SQLException {
		return (Long) this.getObject(columnLabel);
	}

	@Override
	public float getFloat(String columnLabel) throws SQLException {
		return (Float) this.getObject(columnLabel);
	}

	@Override
	public double getDouble(String columnLabel) throws SQLException {
		return (Double) this.getObject(columnLabel);
	}

	@Override
	public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
		return (BigDecimal) this.getObject(columnLabel);
	}

	@Override
	public byte[] getBytes(String columnLabel) throws SQLException {
		return (byte[]) this.getObject(columnLabel);
	}

	@Override
	public Date getDate(String columnLabel) throws SQLException {
		return (Date) this.getObject(columnLabel);
	}

	@Override
	public Time getTime(String columnLabel) throws SQLException {
		return (Time) this.getObject(columnLabel);
	}

	@Override
	public Timestamp getTimestamp(String columnLabel) throws SQLException {
		return (Timestamp) this.getObject(columnLabel);
	}

	@Override
	public InputStream getAsciiStream(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public InputStream getUnicodeStream(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public InputStream getBinaryStream(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public SQLWarning getWarnings() throws SQLException {
		Object ret;
		if (rs == null || rs.isClosed()) {
			ret = valueOf("getWarnings");
		} else {
			valueMap.put("getWarnings", ret = rs.getWarnings());
		}
		return (SQLWarning) ret;
	}

	@Override
	public void clearWarnings() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public String getCursorName() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Object getObject(int columnIndex) throws SQLException {
		Object ret;
		if (gotFromCache) {
			synchronized (lineNo) {
				int lineNo2 = this.lineNo.get();
				if (lineNo2 - 1 >= dataList.size()) {
					return "weilai.err, why?";
				}
				int ind = lineNo2 - 1;
				if (ind < 0) {
					System.err.println();
					System.err.println("lineNo=" + lineNo2 + ", 1=" + 1);
					ind = lineNo2 - 1;
					System.err.println("a=" + lineNo2);
					System.err.println("b=" + 1);
					System.err.println("c=" + ind);
					return null;
				}
				Object[] aa = dataList.get(ind);
				ret = aa[columnIndex - 1];
				return ret;
			}
		} else {
			ret = rs.getObject(columnIndex);
		}
		//		if (ret instanceof com.sap.db.jdbc.HanaClob) {
		//			com.sap.db.jdbc.HanaClob ha = (com.sap.db.jdbc.HanaClob) ret;
		//			ret = ha.getSubString(1, (int) ha.length());
		//		}
		return ret;
	}

	@Override
	public Object getObject(String columnLabel) throws SQLException {
		Object ret;
		if (gotFromCache) {
			int columnIndex = findColumn(columnLabel);
			return this.getObject(columnIndex);
		} else {
			ret = rs.getObject(columnLabel);
		}
		return ret;
	}

	@Override
	public int findColumn(String columnLabel) throws SQLException {
		return meta.nameToInd.get(columnLabel);
	}

	@Override
	public Reader getCharacterStream(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData4");
		return null;
	}

	@Override
	public Reader getCharacterStream(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData5");
		return null;
	}

	@Override
	public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData6");
		return null;
	}

	@Override
	public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
		Object ret = this.getObject(columnLabel);
		return (BigDecimal) ret;
	}

	@Override
	public boolean isBeforeFirst() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean isAfterLast() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean isFirst() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean isLast() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public void beforeFirst() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void afterLast() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public boolean first() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean last() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public int getRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public boolean absolute(int row) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean relative(int rows) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean previous() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public void setFetchDirection(int direction) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public int getFetchDirection() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public void setFetchSize(int rows) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public int getFetchSize() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public int getType() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public int getConcurrency() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public boolean rowUpdated() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean rowInserted() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public boolean rowDeleted() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}

	@Override
	public void updateNull(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBoolean(int columnIndex, boolean x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateByte(int columnIndex, byte x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateShort(int columnIndex, short x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateInt(int columnIndex, int x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateLong(int columnIndex, long x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateFloat(int columnIndex, float x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateDouble(int columnIndex, double x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateString(int columnIndex, String x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBytes(int columnIndex, byte[] x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateDate(int columnIndex, Date x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateTime(int columnIndex, Time x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateObject(int columnIndex, Object x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNull(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBoolean(String columnLabel, boolean x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateByte(String columnLabel, byte x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateShort(String columnLabel, short x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateInt(String columnLabel, int x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateLong(String columnLabel, long x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateFloat(String columnLabel, float x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateDouble(String columnLabel, double x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateString(String columnLabel, String x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBytes(String columnLabel, byte[] x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateDate(String columnLabel, Date x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateTime(String columnLabel, Time x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateObject(String columnLabel, Object x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void insertRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void deleteRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void refreshRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void cancelRowUpdates() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void moveToInsertRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void moveToCurrentRow() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public Statement getStatement() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Ref getRef(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Blob getBlob(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Clob getClob(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Array getArray(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Ref getRef(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Blob getBlob(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Clob getClob(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Array getArray(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Date getDate(int columnIndex, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Date getDate(String columnLabel, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Time getTime(int columnIndex, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Time getTime(String columnLabel, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public URL getURL(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public URL getURL(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public void updateRef(int columnIndex, Ref x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateRef(String columnLabel, Ref x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(int columnIndex, Blob x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(String columnLabel, Blob x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(int columnIndex, Clob x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(String columnLabel, Clob x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateArray(int columnIndex, Array x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateArray(String columnLabel, Array x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public RowId getRowId(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public RowId getRowId(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public void updateRowId(int columnIndex, RowId x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateRowId(String columnLabel, RowId x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public int getHoldability() throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return 0;
	}

	@Override
	public boolean isClosed() throws SQLException {
		if (gotFromCache)
			return isClosed;
		return rs.isClosed();
	}

	@Override
	public void updateNString(int columnIndex, String nString) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNString(String columnLabel, String nString) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public NClob getNClob(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public NClob getNClob(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public SQLXML getSQLXML(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public SQLXML getSQLXML(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public String getNString(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public String getNString(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Reader getNCharacterStream(int columnIndex) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public Reader getNCharacterStream(String columnLabel) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(int columnIndex, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateClob(String columnLabel, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(int columnIndex, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public void updateNClob(String columnLabel, Reader reader) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
	}

	@Override
	public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public <T> T unwrap(Class<T> iface) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return null;
	}

	@Override
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		if ("".isEmpty())
			throw new RuntimeException("todo_ResultSetForMetaData");
		return false;
	}
	//    static void asert(boolean is, Object msg) {
	//        if (!is)
	//            throw new RuntimeException(msg.toString());
	//    }
}
